package org.example.novelcrawler.controller;

import org.example.novelcrawler.model.CrawlConfig;
import org.example.novelcrawler.service.NovelCrawlerServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;

@RestController
public class CrawlerController {

    @Autowired
    private NovelCrawlerServiceImpl crawlerService;

    @GetMapping("/api/crawl")
    public String crawlNovel(@RequestParam("addr") String addr) throws IOException, InterruptedException {
        crawlerService.parseDownload(addr);
        return "OK";
    }
}